<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div contenteditable id="sample"><span style="white-space:pre"> </span><span id="test">z</span></div>
<div id="log"></div>
<script>
test(function() {
    var selection = window.getSelection();
    selection.collapse(document.getElementById('test'), 0);
    document.execCommand('InsertParagraph');
    // Make sure we don't replace a whitespace in "whitespace:pre" to "&nbsp;"
    // and having DIV around "test".
    assert_equals(document.getElementById('sample').innerHTML, '<span style="white-space:pre"> </span><div><span id="test">z</span></div>');
}, 'InsertParagraph should not crash with whitespace:pre');
</script>
